package edu.sctu.zhoumengxue.day201506.day20150626.practiceJson;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by user12 on 2015/6/26.
 */
public class ListJson {

//    public String getListJson() {
//       JSONObject jsonObject = new JSONObject();
//
//        Map<String,String> map = new HashMap<>();
//        map.put("name","zhou");
//        map.put("sex","man");
//        map.put("age","20");
//
//        Map<String,String> map1 = new HashMap<>();
//        map1.put("name","x cd");
//        map1.put("sex","woman");
//        map1.put("age","20");
//
//        List<Map> list = new ArrayList<>();
//        list.add(map);
//        list.add(map1);
//
//        Employee employee = new Employee();
//        employee.setName("meng");
//        employee.setSex("woman");
//        employee.setAge(18);
//
//        JSONArray array = JSONArray.parseArray(String.valueOf(map));
//        JSONArray array1 = JSONArray.parseArray(String.valueOf(list));
//        JSONArray array2 = JSONArray.parseArray(String.valueOf(employee));
//
//        System.out.println("JSONArray对象数据格式");
//        System.out.println(array.toString());
//        System.out.println(array1.toString());
//        System.out.println(array2.toString());
//
//        jsonObject.put("map",array);
//        jsonObject.put("employee",array1);
//        System.out.println("\n最终的数据格式：");
//        System.out.println(jsonObject.toString());
//
//
//        return jsonObject.toString();
//    }

}
